﻿using System.Windows;
using Caliburn;
using Caliburn.Composition;
using Caliburn.Modules;
using Caliburn.Services;

namespace NServiceBus.Management.Modules
{
    public class EndpointExplorerCommandMenuModule : IModule
    {       
        public void Load()
        {
            DI.Container.LoadFrom(GetType().Assembly);

            var manager = DI.Resolve<ICompositeManager>();
            var composite = manager.GetComposite<IComposite>("MainMenu");
            var customerPanel = Element.FromResource<UIElement>("NServiceBus.Management.EndpointExplorer.Elements.EndpointExplorerCommandMenu.xaml");

            composite.Insert(composite.ComponentCount - 1, customerPanel);
        }

        public void Unload()
        {
            
        }
    }
}
